package org.ayachinene.leetcode.problems;

public class P27 {
    static class Solution {
        public int removeElement(int[] nums, int val) {
            if (nums.length == 0) {
                return 0;
            }

            int next = 0;
            for (int i = 0; i < nums.length; ++i) {
                if (nums[i] != val)
                    nums[next++] = nums[i];
            }
            return next;
        }
    }
}
